package main

import (
	"fmt"
	http "github.com/wangluozhe/chttp"
	"github.com/wangluozhe/requests"
	"github.com/wangluozhe/requests/url"
)

func main() {
	req := url.NewRequest()
	headers := &http.Header{
		"User-Agent":                []string{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/112.0"},
		"accept":                    []string{"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"},
		"accept-language":           []string{"zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2"},
		"accept-encoding":           []string{"gzip, deflate, br"},
		"upgrade-insecure-requests": []string{"1"},
		"sec-fetch-dest":            []string{"document"},
		"sec-fetch-mode":            []string{"navigate"},
		"sec-fetch-site":            []string{"none"},
		"sec-fetch-user":            []string{"?1"},
		"te":                        []string{"trailers"},
		http.PHeaderOrderKey: []string{
			":method",
			":path",
			":authority",
			":scheme",
		},
		http.HeaderOrderKey: []string{
			"user-agent",
			"accept",
			"accept-language",
			"accept-encoding",
			"upgrade-insecure-requests",
			"sec-fetch-dest",
			"sec-fetch-mode",
			"sec-fetch-site",
			"sec-fetch-user",
			"te",
		},
	}
	req.Headers = headers
	req.TLSExtensions = &http.TLSExtensions{}
	req.TLSExtensions.ClientHelloHexStream = "16030107b4010007b00303297a9f99030f1f6f963cd97707ce6afcd9a0641d529687f8001812fb281e7f2e2024c5b25926bc62a04b7fab0289b1f9ef2e6e4657fcbd6f14333415c61f80e05b00202a2a130113021303c02bc02fc02cc030cca9cca8c013c014009c009d002f003501000747aaaa000044cd00050003026832002d0002010100120000fe0d011a00000100011b00200ec8d22a5d2fa3db586816a6ef3b2a84a2fcdbc8dcbfe50f9e7636cc03143c2700f0949a7f091f6a068a9f336a799a51aa33b060ba067b0f536e1ef3cd9da2a65bed5f6134ff58d161e400da60cd5edc3c0d9c98fb2ae95cf7877c6578662ca1b4d6f56d556e57f8becce03bafedf738ad8509c08ebcfe982a12370607072b760feba3943c361aa78382c17cb5cb1fa1e35c9d8076584f1e37ec336fb8731430204c978046f790c3fbf5a3f50e1c40ad9fe83f1d13990b785e452d94208ea5bcc71feba2016b4b9aeae4086469ff349e7379511a3267d213dd78ede59086127dd52102ae89cb86224fbe126e5435991a11d13a926200a01fda1389908f500aea71c24b8226aa3aa53cecd61526ab5545a65e001b000302000200230000000500050100000000003304ef04ed1a1a00010011ec04c093f521c8c5beab3cc6db7a1b3df31da9e981bf795fe27b6497a3cb3ef23996ac77151c48128240697661a8d6adb6ea09dd06bb0760b5beab847ff4896f537dec36701eebc12de7bc9c155417321c07a31127e35aa5754b1eb2ca7285287c391d6077830113b0009c7904caaf66772d9e174d332315c99b38bb20115fdcc7e6a46d896b763789b2e693526ee7655982a845923192d31c36834046d0246cd5b43f30b73ed1833822cfd99c93066557ab8188f2d97e45b944bfac4686e0b01685674a0a3d3b324ad383ad5dd7137375a5c4940c0f7b40dfcca3f290ce2cd949a466c270035d926304bad804a1b5a756717252980b2473bcca5b58b0461268e435cf269d9da3a150d835f1784b975513c4d3c0159242bbc94ff1d76887f40eca86caabcc233db525cb441333d89788d599fa057af91b4c84b55496824dcb23bdcc007d68e71230548a51899eec62272a7592d22c0e3db6330b64ca1ea25b61981368124e1b210426e3c594d6c84a148cb27882ea028d9616afc0d35760dcbd13600ddb8505ed87bb8b8921c124491173457f414bd4849dbb8264a184970b4725f945c3538741c7931cf033190707ce755ccc0da03b03a3688d2b0686c595524866055c282200a119f358279240c3fc94ae34471135b8e7c37631d7cc7a83090d9c199a70050a1c7135697fed927581306a4c1995ad78c726f25155a15661354e816221b8d5b0daa39e822286fb959334d2718210a46d2b4e4890b6a402cfba182751e567e6ab8522c24b7776c2257c7f5af080c65780a4f2423197115af522648239f1e6b03349640bc25fbbdac1eb161748801b78599bc9dc1bbaf3825b93cd78d149541789982b77bb30b888e559ff7b4b5c8608bb237eee1a8d83acb016b49ce56c237f50621d46c421e207b0138a4db6acd1c07cc96c56e4b7a0d60ac08775601e77cdc206aa3f01026fdaa5ed288be274560c353617237b98c3c7f9d8121e494944739b766007563c45da407a15c7914aac07f0012dcd856c230c674c779c74b827e25b7b53305522a6425675b27345a7d2a5729cda108b645d83e4ced766071eb4486b7c40ae998f3c73473a684a75872b6c8848e6a72d26f3a1bdd74c0948b3a90928cdcc9082d954ae1c7d0a87778f975962b2a64c28ad2684157c65951b06badf94afab8081c266477a62831ab2492f06bd509aa8887b7aaa076ead23622e29a9d2f37c9c17a8a006a3ba436e57fb5ded499f68b866af1a4a21fa6e2eba85f65620ed2b80ca226a8ee018454345db03297a5980076783e185489627a54f46cd4fcb6e3415aca097a74581057fd01ebb3cc93c0552009b9c57103bd1a629920c801e48b71bf5cdaf86baa1b3c8cd00b307836b856cb335f33ca79c50ac638fa3cb7725e931e331a5d0883af3e9c12c0970f6bcabcd7a082ac739a8922a68a87f9d728c5b826a4ac707e554ce13da9e80dc76ee951dc56a7315d168776cc6a0708e00b35d93c9c1d5b35d294c7bb102949db48c2b96c2b4b86c8cbb2d936b323152a0d7444f0a6b26a32a494c1bb9f3524860292558175fb0563a8aba2f6c6082b05791dc2c39425ccb96544d9132a5a8fbb20617522a101adaeca52e5b5d11d1ecd01169d99005130fe2f25c92e3e183ebc1d55f0a7bce914384c023d64991770cd2f65a8bdac2c52c43b1f8825d8de970afc9869ebfe6a8691ce52d4668001d00200b91d21737c5d8bd0a06762d60b553de6736b46922beba78ce92061d09a50517ff010001000010000e000c02683208687474702f312e31002b000706baba03040303000a000c000a1a1a11ec001d0017001800000010000e00000b746c732e706565742e7773000d0012001004030804040105030805050108060601000b00020100001700008a8a0001000029009c0077007151e3c727aee70068f242743ab57930ddef7f86275e06bc109d5395b20a68259290130a7403d2622bac87a3511a5e55321cdc255324cd4bc0311faf8680776e0a1728799dba455b5eee62609b255a0310fe8586998862ed94f4e12ae1fd2e077be3e3d297230db983eabc33aa67d3ebad630294003a00212031ff9a0eec492f58af25fcf60ba41ccc4e2d6e961622e9c56b9f14bd10c9703e"
	r, err := requests.Get("https://tls.peet.ws/api/all", req)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(r.Request.Headers)
	fmt.Println("url:", r.Url)
	fmt.Println("headers:", r.Headers)
	fmt.Println("text:", r.Text)
	r, err = requests.Get("https://tls.peet.ws/api/all", req)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(r.Request.Headers)
	fmt.Println("url:", r.Url)
	fmt.Println("headers:", r.Headers)
	fmt.Println("text:", r.Text)
}
